package com.google.zxing.pdf417.decoder;

import com.google.zxing.pdf417.PDF417Common;
import java.lang.reflect.Array;

final class PDF417CodewordDecoder
{
  private static final float[][] RATIOS_TABLE;

  static
  {
    int[] arrayOfInt = { PDF417Common.SYMBOL_TABLE.length, 8 };
    RATIOS_TABLE = (float[][])Array.newInstance(Float.TYPE, arrayOfInt);
    for (int i = 0; i < PDF417Common.SYMBOL_TABLE.length; i++)
    {
      int j = PDF417Common.SYMBOL_TABLE[i];
      int k = j & 0x1;
      for (int m = 0; m < 8; m++)
      {
        float f = 0.0F;
        while ((j & 0x1) == k)
        {
          f += 1.0F;
          j >>= 1;
        }
        k = j & 0x1;
        RATIOS_TABLE[i][(-1 + (8 - m))] = (f / 17.0F);
      }
    }
  }

  private static int getBitValue(int[] paramArrayOfInt)
  {
    long l1 = 0L;
    for (int i = 0; i < paramArrayOfInt.length; i++)
    {
      int j = 0;
      if (j < paramArrayOfInt[i])
      {
        long l2 = l1 << 1;
        if (i % 2 == 0);
        for (int k = 1; ; k = 0)
        {
          l1 = l2 | k;
          j++;
          break;
        }
      }
    }
    return (int)l1;
  }

  private static int getClosestDecodedValue(int[] paramArrayOfInt)
  {
    int i = PDF417Common.getBitCountSum(paramArrayOfInt);
    float[] arrayOfFloat1 = new float[8];
    for (int j = 0; j < arrayOfFloat1.length; j++)
      arrayOfFloat1[j] = (paramArrayOfInt[j] / i);
    float f1 = 3.4028235E+38F;
    int k = -1;
    int m = 0;
    if (m < RATIOS_TABLE.length)
    {
      float f2 = 0.0F;
      float[] arrayOfFloat2 = RATIOS_TABLE[m];
      for (int n = 0; ; n++)
        if (n < 8)
        {
          float f3 = arrayOfFloat2[n] - arrayOfFloat1[n];
          f2 += f3 * f3;
          if (f2 < f1);
        }
        else
        {
          if (f2 < f1)
          {
            f1 = f2;
            k = PDF417Common.SYMBOL_TABLE[m];
          }
          m++;
          break;
        }
    }
    return k;
  }

  private static int getDecodedCodewordValue(int[] paramArrayOfInt)
  {
    int i = getBitValue(paramArrayOfInt);
    if (PDF417Common.getCodeword(i) == -1)
      i = -1;
    return i;
  }

  static int getDecodedValue(int[] paramArrayOfInt)
  {
    int i = getDecodedCodewordValue(sampleBitCounts(paramArrayOfInt));
    if (i != -1)
      return i;
    return getClosestDecodedValue(paramArrayOfInt);
  }

  private static int[] sampleBitCounts(int[] paramArrayOfInt)
  {
    float f1 = PDF417Common.getBitCountSum(paramArrayOfInt);
    int[] arrayOfInt = new int[8];
    int i = 0;
    int j = 0;
    for (int k = 0; k < 17; k++)
    {
      float f2 = f1 / 34.0F + f1 * k / 17.0F;
      if (j + paramArrayOfInt[i] <= f2)
      {
        j += paramArrayOfInt[i];
        i++;
      }
      arrayOfInt[i] = (1 + arrayOfInt[i]);
    }
    return arrayOfInt;
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.google.zxing.pdf417.decoder.PDF417CodewordDecoder
 * JD-Core Version:    0.6.2
 */